<?php

namespace App\Http\Controllers\YApi;

//use Illuminate\Http\Request;
use Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

use Session;
use Redirect;

use App\Models\UsersReg;
use App\Models\Bags;
use App\Models\Book;

class BookidListUserController extends Controller
{
	public function bookidlistuser()
	{
		// 显示全部转让这本书的会员和这本书的信息列表		
		$bookid = request::input('bookid');		
		$bags = Bags::where('book_id', $bookid)->orderBy('add_time', 'desc')->paginate(15);

		foreach($bags as $bag) {
			// 对应的书籍信息
			$bag['books'] = Book::find($bag->book_id);
		}

		foreach($bags as $bag) {
			// 对应的会员的信息
			$bag['users'] = UsersReg::find($bag->uid);
		}

		return $bags;
	}
}
